package com.RedRiver.hospitalsystem.finance_service.app.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class MybatisPConfig implements MetaObjectHandler {
    /**
     * 向数据库表中插入数据时，自动填充
     * @param metaObject
     */
    @Override
    public void insertFill(MetaObject metaObject) {
//        long time = System.currentTimeMillis();
        LocalDateTime time= LocalDateTime.now();
        this.fillStrategy(metaObject, "createTime", time);
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }

}
